import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FormBuilder } from '@angular/forms';

@Component({
  selector: 'app-equipment-createion',
  templateUrl: './equipment-createion.component.html',
  styleUrls: ['./equipment-createion.component.sass']
})
export class EquipmentCreateionComponent implements OnInit {
 checkoutForm = this.formBuilder.group({
     model: '',
     manufactureDate:'',
  });
  constructor(
    private formBuilder: FormBuilder,
    private http: HttpClient
    ) { }

  ngOnInit(): void {
  }
  addMovie(e:any){
      console.log(e.value)
  let headers = new HttpHeaders();
  headers= headers.set('content-type', 'application/json');
      let res = this.http.post('http://localhost:8000/equipments',e.value,{headers})
        res.subscribe(

           data => alert('creation success'),
        error => alert('oops')
        );
    }

}
